package com.catering.controller.untilController;

import com.catering.until.CommonUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@Slf4j
public class UntilController {
	@Value("${file.upload-dir}")
	private String itemPath;//item存储地址


	/**
	 * 删除单个文件
	 * @param file
	 * @return
	 */
	@RequestMapping("/delFile")
	public boolean delFile(@RequestBody Map<String, String> map) {
		String fileName = map.get("fileName");
		log.info("删除的文件列表{}",fileName);
		String type =  map.get("type");
		if("0".equals(type)) map.put("filePath",itemPath);
		return CommonUtils.delFile(map);
	}
}
